#include <prometheus/summary.h>
#include <prometheus/exposer.h>
#include <prometheus/registry.h>

#include <array>
#include <chrono>
#include <cstdlib>
#include <memory>
#include <string>
#include <thread>

int main() {
  using namespace prometheus;

  Exposer exposer{"127.0.0.1:8082"};

  auto registry = std::make_shared<Registry>();
  auto& health_summary = prometheus::BuildSummary()
                           .Name("strategy_health_summary")
                           .Help("strategy health summary")
                           .Register(*registry);
  const Labels labels = {{"feed_type", "ET_FT_DIFF"}, {"mea", "Futures.Binance.v1"}};
  auto& et_ft_diff_summary = health_summary.Add(labels, Summary::Quantiles{{0.25, 0.05}, {0.5, 0.05}, {0.75, 0.05}, {1, 0}});
  exposer.RegisterCollectable(registry);

  for (;;) {
    for (int i = 0; i < 100; i++) {
      et_ft_diff_summary.Observe(static_cast<double>(i));
      std::this_thread::sleep_for(std::chrono::milliseconds(1000));
    }
  }
}
